<!--#include file="lib/utf-8.asp"-->
<!--#include file="lib/connopen.asp"-->
<!--#include file="lib/asp-common-lib.asp"-->
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>报关单登记系统</title>
<!--#include file="lib/plugins.asp"-->
<style type="text/css">
	.ui-datepicker table {
		border: 0;
	}
	#tablelist{
		min-width:30%;
	}
	#tmp{
		font-family:宋体;
	}
</style>
<script type="text/javascript">
	$(function() {
	});
</script>	
<!--#include file="lib/js-google-analytics.asp"-->
</head>
<%
if not CheckPostFlag(session("aaPostFlag"),0,15) then call JumpErrorPage(2)
id=request("id")
tmp=request("tmp")
submit=request("submit")
if id<>"" then
	sql = "select * from wtr where id="&id
	Set rs = Server.CreateObject("ADODB.Recordset")
	rs.Open sql,conn,1,1
	if not rs.eof then
		wtr=rs("wtr")
		tmp=rs("tmp")
	end if
	rs.close
	set rs=nothing
end if
if submit<>"" then
	wtr=request("wtr")
	tmp=clng(request("tmp"))
	if submit="新增" then
		sql="insert into wtr(wtr,tmp) values('"&wtr&"',"&tmp&")"
		tmp=0
	end if
	if submit="保存" then	sql="update wtr set wtr='"&wtr&"',tmp="&tmp&" where id="&id
	set cmd=Server.CreateObject("ADODB.Command")
	cmd.ActiveConnection = conn
	cmd.CommandText = sql
	cmd.Execute
end if
%>

<body>
<!--#include file="lib/header.asp"-->
<!--#include file="lib/nav.asp"-->
<div id="main">
<!--#include file="lib/col1.asp"-->
<!--#include file="lib/col2.asp"-->
	<div id="col3" role="main">
		<div id="col3_content" class="clearfix">
			<form name="form1" method="post" class="yform" role="application">
				<div class="type-text">
					<label for="wtr">委托人*</label>
					<input name="wtr" id="wtr" type="text" size="10"  value="<%if submit="新增" then response.write("") else response.write(wtr)%>" />
				</div>
				<div class="type-select">
					<label for="tmp">报关费模板</label>
					<select name="tmp" id="tmp">
						<option value="0">模板&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;应收&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;应付</option>
						<%
							Set rs_tmp = Server.CreateObject("ADODB.Recordset")
							sql = "SELECT * FROM tmp order by id"
							rs_tmp.Open sql,conn,1,1
							do while not rs_tmp.eof
						%>
						<option value="<%=rs_tmp("id")%>" <%if rs_tmp("id")=tmp then response.write("selected='selected'")%>><%=FillSpace(rs_tmp("id"),10)&FillSpace(rs_tmp("receive"),10)&rs_tmp("pay")%></option>
						<%
								rs_tmp.movenext
							loop
							rs_tmp.close
							set rs_tmp=nothing
						%>
					</select>
				</div>
				<div class="type-button">
				<%
					if id<>"" then
				%>
					<input type="submit" name="submit" class="submit" value="保存" />
				<%
					else
				%>
					<input type="submit" name="submit" class="submit" value="新增" />
				<%
					end if
				%>
				</div>
			</form>
			<table id="tablelist">
				<thead>
					<tr><th colspan="3" scope="col">委托人明细</th></tr>
				</thead>
				<tbody>
					<tr>
						<th scope="col">ID</th>
						<th scope="col">委托人</th>
						<th scope="col">报关费模板</th>
					</tr>
					<%
						sql = "select * from wtr left join tmp on wtr.tmp=tmp.id order by wtr"
						Set rs = Server.CreateObject("ADODB.Recordset")
						rs.Open sql,conn,1,1
						do while not rs.eof
					%>
					<tr>
						<th class="sub" scope="row"><a href="wtr.asp?id=<%=rs("wtr.id")%>"><%=rs("wtr.id")%></a></th>
						<td><%=rs("wtr")%></td>
						<td><%if rs("tmp.id")<>"" then%><a href="tmp.asp?id=<%=rs("tmp")%>"><%=rs("receive")&"|"&rs("pay")%></a><%end if%></td>
					</tr>
					<%
						
							rs.movenext
						loop
						rs.close
						set rs=nothing
					
					%>
					
				</tbody>
			</table>
		</div>
	</div>
</div>
<!--#include file="lib/footer.asp"-->
</body>
</html>
<!--#include file="lib/connclose.asp"-->

